package com.itheima.alipay.utils;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfigInfo {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2016101600703540";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCK3aW4rIZSu9oFYpfKuk1hF3GkPcmUa8znUb6NuKcMJcpaNj/j09F5P2O9swxU0amktTKNKNW1BvQhLfdNcMtgY4IuibYfCyFBu+zbuae3G8xHduSSI99+Nwy7VdNCby6hgy/8EYXZxSN3Z9/Qobb2SneEGAujWPtTj9BvfcTaY2IyzKAr43LDreeDUJvLbud5xASexo4HKXu3fP6T6/VvXirCVSJXF4hI1qU41hNh8ewnP7mZe+vSrK3HC4KfyAJiYLE6cA1gcLNV/HhK172uYR5pYDFU+GX5A5Iqea+vlES+B0IEgyxz1j5MTJ5tnSZEpwbmJsrZQzT/8qyC8elDAgMBAAECggEAZgDiFoFEOcmbIJGHhnbLGCKsa0Snqcp1vQUiv99/dUDdHt7yl1ukZzfVACdhS3ym7EHdXCs+r7bn5Odq3QuZmLf/jEfD65G1YB+2oMADHlHhAC2pQF/xbzjotUMZ55bb3fALc1E7zPcuUiuPECV5y/hvSiyPf/GAy6S8KulrjC6QRCyUaM71InhbMUiCqGFf0D/TuW8Kg1YmxOh2BxHeygFZBT/UlOBT3v78uzy/DY9dXQCFGZAwdk01rUbjUM39JRPUsxH0ac67BsMHHuJB8Zw6iOsMCOBznX3ZDBGJ6/wN9uFifbJoXG4fP3j5o9anjEKonNvNgaRvwOFySSyCIQKBgQDtMUq+cUXTMzjGm1FXnI4IZ4B7s78hAPyTbcuXTqrFBKvbDFZoi/81ENhbvAzUGccKPY4W3aLDFmykzSOIhUi3Pf5Hg0WVYXO7C/jJy0JPkzEXizwm+kXtzB1YnER3ewYWw/jmCdAUQ7eykzoV/qWQdzDSRevC14th2ocBEq2FxwKBgQCV4HJ/36cDzuxjSQRfK/FbCCP9WbXJdN4g6sNnkiEv7Z7f5SuTwarArzQlvWaD07cxkmhjL3Nt1SDvwalvq+wQhf5CHTuS13h84uw7DIUcUZv6VTWFN7l8gSA31/aFwJhWP76Kx/EGifox4sNQD2o4LBCREtEb4z9LUmycLE/QpQKBgBddm7dXAUHk8drewgyXZ4Z8a7PD6TgfGMKNNlkZbskpxKQ3euuhnupjVmzzAXCDeZAQsEagXsBJHTq+2plASAGFId95lwk4KGZsr31xgH7GSTfAh5RvYyQhz2JDQptiix8C/ynqHY1hfl8hEb/I7hZlJ3IPYUI4aYqiNFputJlRAoGAWBuFVDUnmu6HOurO3iAYF/rWJXcajh7dAp7gVr+qMOHRFzBDCO6+Md4Nmu4YGQFaXZMDOOPJSNUVMr03nUWFVkVfLoC+59kxpMFGPIRksDwtpOF4wCL9MPs79HhKHWEWbQW2PyHBSKXOZos3ZJZbTEBjUNWuBmX2bJI89SZ7mV0CgYBYiUbpj8zFWewbPhAHkdjzGr31lO0ulpIpASGSAGmleSnlweT7RW1VhwhWpMEv1wD7u07BVGY22YrIsBlvVbtMvNskWdJmah/0qPfgARH1pPsPlVwMtwCx/g70J1V8FZNW1mSZRwwIk5ge7geIpjHM5a3QBubzh27oZcjOrGF/Eg==";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArGrs+65xf9nIFQwJTCuD3iPBY8aDPT6ygqiwv6Srt0pNibr0KR7NIT01YwJJRr/ecxljkM/k7OdtCXFoJWA8uJjHCEXU9NbwG8GvDV5PpWkXxIQ2DvzLkFCxsyJwShRVJRPuVCqQlryYz97bq/pG8erGeVZz8Df/j27jYiPdDYQaUU3Oi+u63pw23lTSDMSiREZ5BVBUk/y1I54nveLrjniuEmn06EmsenEOSKLzIH5DJ4q10j+8r+wWCADAHC2JyyHUiw87GlhzQKTUHsJl9+vcAcuAYRGE8ADqCK7j8cu5vXVfrJw22oc4vw6jLQMC6lWcLeHIKcsneZzChYmJ5QIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://工程公网访问地址/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "http://工程公网访问地址/alipay.trade.page.pay-JAVA-UTF-8/return_url.jsp";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}